﻿using System;

namespace SerialManager
{
    /// <summary>
    /// Information about episode created by <see cref="Loaders.IEpisodeLoader"/>
    /// </summary>
    public class EpisodeInfo
    {
        /// <summary>
        /// Number of season which owns this informations
        /// </summary>
        public int Season { get; set; }
        
        /// <summary>
        /// Number of episode which owns this informations
        /// </summary>
        public int Number { get; set; }

        /// <summary>
        /// Title of episode
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// Fixed identification of information instance
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return (Season * 1000) + Number;
        }

        /// <summary>
        /// Equality test to other <see cref="EpisodeInfo"/> instance
        /// </summary>
        public override bool Equals( object obj )
        {
            EpisodeInfo ep = obj as EpisodeInfo;
            if( ep == null )
                return false;
            return ( ep.GetHashCode() == this.GetHashCode() );
        }
    }
}
